package ctrFinanceiro.dmp;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * The persistent class for the usuario database table.
 * 
 */
@Entity
@Table(name = "usuario", schema = "financeiro")
@NamedQueries({
		@NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"),
		@NamedQuery(name = "Usuario.findByLogin", query = "SELECT u FROM Usuario u WHERE u.login = :p0"),
		@NamedQuery(name = "Usuario.findByNome", query = "SELECT u FROM Usuario u WHERE u.nome = :p0") })
public class Usuario implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name = "USUARIO_IDUSU_GENERATOR", sequenceName = "financeiro.usuario_id_usu_seq" , allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "USUARIO_IDUSU_GENERATOR")
	@Column(name = "id_usu", unique = true, nullable = false)
	private Integer idUsu;

	@Column(name = "usu_login", nullable = false, length = 10)
	private String login;

	@Column(name = "usu_nome", nullable = false, length = 100)
	private String nome;

	@Column(name = "usu_senha", nullable = false, length = 6)
	private String senha;

	// bi-directional many-to-one association to CfinConta
	/*
	 * @OneToMany(mappedBy="usuario") private List<Conta> cfinContas;
	 */
	public Usuario() {
	}

	public Usuario(Integer id, String nome, String login, String senha) {
		super();
		this.idUsu = id;
		this.nome = nome;
		this.login = login;
		this.senha = senha;
	}
	
	public Usuario(String login, String nome, String senha) {
		super();
		this.login = login;
		this.nome = nome;
		this.senha = senha;
	}

	public Integer getIdUsu() {
		return idUsu;
	}

	public void setIdUsu(Integer idUsu) {
		this.idUsu = idUsu;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	@Override
	public String toString() {
		return idUsu + " - " + nome;
	}

	/*
	 * public List<Conta> getCfinContas() { return this.cfinContas; }
	 * 
	 * public void setCfinContas(List<Conta> cfinContas) { this.cfinContas =
	 * cfinContas; }
	 */
}